<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
          Google Web Toolkit
          
            -
            UIObject</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="../css/base.css" rel="stylesheet" type="text/css">
<link href="./doc.css" rel="stylesheet" type="text/css">
<link href="../css/print.css" rel="stylesheet" media="print" type="text/css">
</head>
<body>
<div id="gaia">&nbsp;</div>
<div id="header">
<div id="logo">
<a href="http://code.google.com/"><img src="http://code.google.com/images/code_sm.png" alt="Google"></a>
</div>
<div id="title">Google Web Toolkit (Beta)</div>
<div id="breadcrumbs">
<div id="nextprev">
<nobr><a href="com.google.gwt.user.client.ui.TreeListenerCollection.html">&laquo; prev</a></nobr><nobr><a href="com.google.gwt.user.client.ui.VerticalPanel.html">next &raquo;</a></nobr>
</div>
<span class="item"><a href="http://code.google.com/">Google Code Home</a></span>
        &gt;
        <span class="item"><a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a></span>
        &gt;
        
        <span class="item"><a xmlns="" href="gwt.html">GWT Class Reference</a></span> &gt;
            <span class="item"><a href="com.google.gwt.user.client.ui.html">com.google.gwt.user.client.ui</a></span> &gt;
            <span class="selected item">UIObject</span>
</div>
</div>
<div id="side">
<div id="menu">
<h4>
<a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a>
</h4>
<ul>
<li>
<a href="http://code.google.com/webtoolkit/download.html">Download GWT</a>
</li>
</ul>
<ul>
<li>
<a href="http://code.google.com/webtoolkit/overview.html">Product Overview</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/gettingstarted.html">Getting Started Guide</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/documentation/examples/">Example Projects</a>
</li>
</ul>
<ul>
<li>
<a href="./com.google.gwt.doc.DeveloperGuide.html">Developer Guide</a>
</li>
<li>
<a class="selected" href="./gwt.html">Class Reference</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/issues/">Issue Tracking</a>
</li>
<li>
<a href="http://groups.google.com/group/Google-Web-Toolkit">Developer Forum</a>
</li>
</ul>
<ul>
<li>
<a href="http://googlewebtoolkit.blogspot.com/">GWT Blog</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/faq.html">GWT FAQ</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/makinggwtbetter.html">Making GWT Better</a>
</li>
</ul>
<ul>
<li>
<a href="http://code.google.com/webtoolkit/thirdparty.html">Third Party Tools</a>
</li>
</ul>
</div>
<div id="search">
<form action="http://www.google.com/search" method="get">
<div>
<input name="domains" value="code.google.com" type="hidden"><input name="sitesearch" value="code.google.com" type="hidden">
<div class="header">Search this site:</div>
<div class="input">
<input name="q" size="10">
</div>
<div class="button">
<input value="Search" type="submit">
</div>
</div>
</form>
</div>
</div>
<div xmlns="http://www.w3.org/1999/xhtml" id="body">
<h1>Class UIObject</h1>
<div class="classSig">public 
            class 
            UIObject<br>extends
                <a xmlns="" href="java.lang.Object.html">Object</a>
<br>
<br>// Superclass of <code><a href="com.google.gwt.user.client.ui.MenuItem.html">MenuItem</a></code>, <code><a href="com.google.gwt.user.client.ui.TreeItem.html">TreeItem</a></code>, <code><a href="com.google.gwt.user.client.ui.Widget.html">Widget</a></code>
</div>The base class for all user-interface objects. It simply wraps a DOM element,
 and cannot receive events. Most interesting user-interface classes derive
 from <a href="com.google.gwt.user.client.ui.Widget.html">Widget</a>.<h2 class="api">Methods</h2>
<table cellpadding="1" cellspacing="1" class="members">
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#addStyleName(java.lang.String)">addStyleName(String)</a></td><td>Adds a style name to the widget. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getAbsoluteLeft()">getAbsoluteLeft()</a></td><td>Gets the object's absolute left position in pixels, as measured from the
 browser window's client area. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getAbsoluteTop()">getAbsoluteTop()</a></td><td>Gets the object's absolute top position in pixels, as measured from the
 browser window's client area. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getElement()">getElement()</a></td><td>Gets a handle to the object's underlying DOM element. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getOffsetHeight()">getOffsetHeight()</a></td><td>Gets the object's offset height in pixels. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getOffsetWidth()">getOffsetWidth()</a></td><td>Gets the object's offset width in pixels. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getStyleName()">getStyleName()</a></td><td>Gets the style name associated with the object. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#getTitle()">getTitle()</a></td><td>Gets the title associated with this object. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#isVisible(com.google.gwt.user.client.Element)">isVisible(Element)</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#isVisible()">isVisible()</a></td><td>Determines whether or not this object is visible. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#removeStyleName(java.lang.String)">removeStyleName(String)</a></td><td>Removes a style name from the widget. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setElement(com.google.gwt.user.client.Element)">setElement(Element)</a></td><td>Sets this object's browser element. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setHeight(java.lang.String)">setHeight(String)</a></td><td>Sets the object's height. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setPixelSize(int, int)">setPixelSize(int, int)</a></td><td>Sets the object's size, in pixels, not including decorations such as
 border, margin, and padding. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setSize(java.lang.String, java.lang.String)">setSize(String, String)</a></td><td>Sets the object's size. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setStyleName(com.google.gwt.user.client.Element, java.lang.String, boolean)">setStyleName(Element, String, boolean)</a></td><td>This convenience method implements allows one to easily add or remove the
 style name for any element. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setStyleName(java.lang.String)">setStyleName(String)</a></td><td>Sets the object's style name, removing all other styles. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setTitle(java.lang.String)">setTitle(String)</a></td><td>Sets the title associated with this object. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setVisible(com.google.gwt.user.client.Element, boolean)">setVisible(Element, boolean)</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setVisible(boolean)">setVisible(boolean)</a></td><td>Sets whether this object is visible. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#setWidth(java.lang.String)">setWidth(String)</a></td><td>Sets the object's width. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#sinkEvents(int)">sinkEvents(int)</a></td><td>Adds a set of events to be sunk by this object. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#toString()">toString()</a></td><td>This method is overridden so that any object can be viewed in the debugger
 as an HTML snippet. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.UIObject.html#unsinkEvents(int)">unsinkEvents(int)</a></td><td>Removes a set of events from this object's event list. </td>
</tr>
</table>
<h2 class="api">Method Detail</h2>
<a name="addStyleName(java.lang.String)"></a>
<h3 class="api">addStyleName</h3>
<div class="memberSig">public void<b> addStyleName</b>(<nobr><a href="java.lang.String.html">String</a> style</nobr>)</div>Adds a style name to the widget.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>style</dt>
<dd>the style name to be added</dd>
</dl>
<h4 class="api">See Also</h4>
<a href="com.google.gwt.user.client.ui.UIObject.html#removeStyleName(java.lang.String)">removeStyleName(String)</a>
<hr>
<a name="getAbsoluteLeft()"></a>
<h3 class="api">getAbsoluteLeft</h3>
<div class="memberSig">public int<b> getAbsoluteLeft</b>()</div>Gets the object's absolute left position in pixels, as measured from the
 browser window's client area.<h4 class="api">Return Value</h4>the object's absolute left position<hr>
<a name="getAbsoluteTop()"></a>
<h3 class="api">getAbsoluteTop</h3>
<div class="memberSig">public int<b> getAbsoluteTop</b>()</div>Gets the object's absolute top position in pixels, as measured from the
 browser window's client area.<h4 class="api">Return Value</h4>the object's absolute top position<hr>
<a name="getElement()"></a>
<h3 class="api">getElement</h3>
<div class="memberSig">public <a href="com.google.gwt.user.client.Element.html">Element</a><b> getElement</b>()</div>Gets a handle to the object's underlying DOM element.<h4 class="api">Return Value</h4>the object's browser element<hr>
<a name="getOffsetHeight()"></a>
<h3 class="api">getOffsetHeight</h3>
<div class="memberSig">public int<b> getOffsetHeight</b>()</div>Gets the object's offset height in pixels. This is the total height of the
 object, including decorations such as border, margin, and padding.<h4 class="api">Return Value</h4>the object's offset height<hr>
<a name="getOffsetWidth()"></a>
<h3 class="api">getOffsetWidth</h3>
<div class="memberSig">public int<b> getOffsetWidth</b>()</div>Gets the object's offset width in pixels. This is the total width of the
 object, including decorations such as border, margin, and padding.<h4 class="api">Return Value</h4>the object's offset width<hr>
<a name="getStyleName()"></a>
<h3 class="api">getStyleName</h3>
<div class="memberSig">public <a href="java.lang.String.html">String</a><b> getStyleName</b>()</div>Gets the style name associated with the object.<h4 class="api">Return Value</h4>the object's style name<h4 class="api">See Also</h4>
<a href="com.google.gwt.user.client.ui.UIObject.html#setStyleName(java.lang.String)">setStyleName(String)</a>
<hr>
<a name="getTitle()"></a>
<h3 class="api">getTitle</h3>
<div class="memberSig">public <a href="java.lang.String.html">String</a><b> getTitle</b>()</div>Gets the title associated with this object. The title is the 'tool-tip'
 displayed to users when they hover over the object.<h4 class="api">Return Value</h4>the object's title<hr>
<a name="isVisible(com.google.gwt.user.client.Element)"></a>
<h3 class="api">isVisible</h3>
<div class="memberSig">public static boolean<b> isVisible</b>(<nobr><a href="com.google.gwt.user.client.Element.html">Element</a> elem</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>elem</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
<hr>
<a name="isVisible()"></a>
<h3 class="api">isVisible</h3>
<div class="memberSig">public boolean<b> isVisible</b>()</div>Determines whether or not this object is visible.<h4 class="api">Return Value</h4>
<code>true</code> if the object is visible<hr>
<a name="removeStyleName(java.lang.String)"></a>
<h3 class="api">removeStyleName</h3>
<div class="memberSig">public void<b> removeStyleName</b>(<nobr><a href="java.lang.String.html">String</a> style</nobr>)</div>Removes a style name from the widget.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>style</dt>
<dd>the style name to be added</dd>
</dl>
<h4 class="api">See Also</h4>
<a href="com.google.gwt.user.client.ui.UIObject.html#addStyleName(java.lang.String)">addStyleName(String)</a>
<hr>
<a name="setElement(com.google.gwt.user.client.Element)"></a>
<h3 class="api">setElement</h3>
<div class="memberSig">protected void<b> setElement</b>(<nobr><a href="com.google.gwt.user.client.Element.html">Element</a> elem</nobr>)</div>Sets this object's browser element. UIObject subclasses must call this
 method before attempting to call any other methods.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>elem</dt>
<dd>the object's new element</dd>
</dl>
<hr>
<a name="setHeight(java.lang.String)"></a>
<h3 class="api">setHeight</h3>
<div class="memberSig">public void<b> setHeight</b>(<nobr><a href="java.lang.String.html">String</a> height</nobr>)</div>Sets the object's height. This height does not include decorations such as
 border, margin, and padding.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>height</dt>
<dd>the object's new height, in CSS units (e.g. "10px", "1em")</dd>
</dl>
<hr>
<a name="setPixelSize(int, int)"></a>
<h3 class="api">setPixelSize</h3>
<div class="memberSig">public void<b> setPixelSize</b>(<nobr>int width, </nobr><nobr>int height</nobr>)</div>Sets the object's size, in pixels, not including decorations such as
 border, margin, and padding.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>width</dt>
<dd>the object's new width, in pixels</dd>
<dt>height</dt>
<dd>the object's new height, in pixels</dd>
</dl>
<hr>
<a name="setSize(java.lang.String, java.lang.String)"></a>
<h3 class="api">setSize</h3>
<div class="memberSig">public void<b> setSize</b>(<nobr><a href="java.lang.String.html">String</a> width, </nobr><nobr><a href="java.lang.String.html">String</a> height</nobr>)</div>Sets the object's size. This size does not include decorations such as
 border, margin, and padding.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>width</dt>
<dd>the object's new width, in CSS units (e.g. "10px", "1em")</dd>
<dt>height</dt>
<dd>the object's new height, in CSS units (e.g. "10px", "1em")</dd>
</dl>
<hr>
<a name="setStyleName(com.google.gwt.user.client.Element, java.lang.String, boolean)"></a>
<h3 class="api">setStyleName</h3>
<div class="memberSig">protected static void<b> setStyleName</b>(<nobr><a href="com.google.gwt.user.client.Element.html">Element</a> elem, </nobr><nobr><a href="java.lang.String.html">String</a> style, </nobr><nobr>boolean add</nobr>)</div>This convenience method implements allows one to easily add or remove the
 style name for any element. This can be useful when you need to add and
 remove styles from a sub-element within a <a href="com.google.gwt.user.client.ui.UIObject.html">UIObject</a>.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>elem</dt>
<dd>the element whose style is to be modified</dd>
<dt>style</dt>
<dd>the style name to be added or removed</dd>
<dt>add</dt>
<dd>
<code>true</code> to add the given style, <code>false</code>
          to remove it</dd>
</dl>
<hr>
<a name="setStyleName(java.lang.String)"></a>
<h3 class="api">setStyleName</h3>
<div class="memberSig">public void<b> setStyleName</b>(<nobr><a href="java.lang.String.html">String</a> style</nobr>)</div>Sets the object's style name, removing all other styles.
 
 <p>
 The style name is the name referred to in CSS style rules (in HTML, this is
 referred to as the element's "class"). By convention, style rules are of
 the form <code>[project]-[widget]</code> (e.g. the <a href="com.google.gwt.user.client.ui.Button.html">Button</a>
 widget's style name is <code>.gwt-Button</code>).
 </p>
<p>
 For example, if a widget's style name is <code>myProject-MyWidget</code>,
 then the style rule that applies to it will be
 <code>.myProject-MyWidget</code>. Note the "dot" prefix -- this is
 necessary because calling this method sets the underlying element's
 <code>className</code> property.
 </p>
<p>
 An object may have any number of style names, which may be manipulated
 using <a href="com.google.gwt.user.client.ui.UIObject.html#addStyleName(java.lang.String)">addStyleName(String)</a> and <a href="com.google.gwt.user.client.ui.UIObject.html#removeStyleName(java.lang.String)">removeStyleName(String)</a>.
 The attributes of all styles associated with the object will be applied to
 it.
 </p>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>style</dt>
<dd>the style name to be added</dd>
</dl>
<h4 class="api">See Also</h4>
<a href="com.google.gwt.user.client.ui.UIObject.html#addStyleName(java.lang.String)">addStyleName(String)</a>, <a href="com.google.gwt.user.client.ui.UIObject.html#removeStyleName(java.lang.String)">removeStyleName(String)</a>
<hr>
<a name="setTitle(java.lang.String)"></a>
<h3 class="api">setTitle</h3>
<div class="memberSig">public void<b> setTitle</b>(<nobr><a href="java.lang.String.html">String</a> title</nobr>)</div>Sets the title associated with this object. The title is the 'tool-tip'
 displayed to users when they hover over the object.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>title</dt>
<dd>the object's new title</dd>
</dl>
<hr>
<a name="setVisible(com.google.gwt.user.client.Element, boolean)"></a>
<h3 class="api">setVisible</h3>
<div class="memberSig">public static void<b> setVisible</b>(<nobr><a href="com.google.gwt.user.client.Element.html">Element</a> elem, </nobr><nobr>boolean visible</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>elem</dt>
<dd>
<!--[Missing documentation]-->
</dd>
<dt>visible</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
<hr>
<a name="setVisible(boolean)"></a>
<h3 class="api">setVisible</h3>
<div class="memberSig">public void<b> setVisible</b>(<nobr>boolean visible</nobr>)</div>Sets whether this object is visible.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>visible</dt>
<dd>
<code>true</code> to show the object, <code>false</code>
          to hide it</dd>
</dl>
<hr>
<a name="setWidth(java.lang.String)"></a>
<h3 class="api">setWidth</h3>
<div class="memberSig">public void<b> setWidth</b>(<nobr><a href="java.lang.String.html">String</a> width</nobr>)</div>Sets the object's width. This width does not include decorations such as
 border, margin, and padding.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>width</dt>
<dd>the object's new width, in CSS units (e.g. "10px", "1em")</dd>
</dl>
<hr>
<a name="sinkEvents(int)"></a>
<h3 class="api">sinkEvents</h3>
<div class="memberSig">public void<b> sinkEvents</b>(<nobr>int eventBitsToAdd</nobr>)</div>Adds a set of events to be sunk by this object. Note that only
 <a href="com.google.gwt.user.client.ui.Widget.html">widgets</a> may actually receive events, but can receive events
 from all objects contained within them.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>eventBitsToAdd</dt>
<dd>a bitfield representing the set of events to be added
          to this element's event set</dd>
</dl>
<h4 class="api">See Also</h4>
<a href="com.google.gwt.user.client.Event.html">Event</a>
<hr>
<a name="toString()"></a>
<h3 class="api">toString</h3>
<div class="memberSig">public <a href="java.lang.String.html">String</a><b> toString</b>()</div>This method is overridden so that any object can be viewed in the debugger
 as an HTML snippet.<h4 class="api">Return Value</h4>a string representation of the object<hr>
<a name="unsinkEvents(int)"></a>
<h3 class="api">unsinkEvents</h3>
<div class="memberSig">public void<b> unsinkEvents</b>(<nobr>int eventBitsToRemove</nobr>)</div>Removes a set of events from this object's event list.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>eventBitsToRemove</dt>
<dd>a bitfield representing the set of events to be
          removed from this element's event set</dd>
</dl>
<h4 class="api">See Also</h4>
<a href="com.google.gwt.user.client.ui.UIObject.html#sinkEvents(int)">sinkEvents</a>, <a href="com.google.gwt.user.client.Event.html">Event</a>
</div>
<div id="footer" xmlns="http://www.w3.org/1999/xhtml">
          &copy;2007 Google
          <span class="noprint">
            -
            <a href="http://www.google.com/">Google Home</a>
            -
            <a href="http://www.google.com/jobs/">We're Hiring</a>
            -
            <a href="http://www.google.com/privacy.html">Privacy Policy</a>
            -
            <a href="http://www.google.com/terms_of_service.html">Terms of Service</a>
            -
            <a href="mailto:code@google.com">Contact Us</a></span>
<div id="license" style="text-align: center; margin: 1em 0em 1em 0em">
            Except as otherwise
            <a href="http://code.google.com/policies.html#restrictions">noted</a>, the content of this  page is licensed under the  <a rel="license" href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>.
              <!--
            <rdf:RDF xmlns="http://web.resource.org/cc/">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by/2.5/"></license>
</Work>
<License rdf:about="http://creativecommons.org/licenses/by/2.5/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction"></permits>
<permits rdf:resource="http://web.resource.org/cc/Distribution"></permits>
<requires rdf:resource="http://web.resource.org/cc/Notice"></requires>
<requires rdf:resource="http://web.resource.org/cc/Attribution"></requires>
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"></permits>
</License>
</rdf:RDF>
              -->
            </div>
</div>
<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"></script><script type="text/javascript">
          _uacct="UA-18071-1"; _uanchor=1; urchinTracker();
        </script>
</body>
</html>
